package com.example.meizu002.service.impl;

import com.example.meizu002.entity.Phone;
import com.example.meizu002.mapper.PhoneMapper;
import com.example.meizu002.service.PhoneService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
@Transactional
public class PhoneServiceImpl implements PhoneService {
    @Autowired
    private PhoneMapper phoneMapper;

    @Override
    public List<Phone> findAll() {
        List<Phone> phoneList = phoneMapper.findAll();
        return phoneList;
    }

    @Override
    public void addPhone(Phone phone) {
        phoneMapper.addPhone(phone);
    }

    @Override
    public void deletePhone(int id) {
        phoneMapper.deletePhone(id);

    }

    @Override
    public Phone findOne(int id) {

        return phoneMapper.findOne(id);
    }

    @Override
    public void updatePhone(Phone phone) {
        phoneMapper.updatePhone(phone);

    }
}
